//
//  NaAudio.swift
//  Screen
//
//  Created by Natsu on 12/30/16.
//  Copyright © 2016 alex.chih. All rights reserved.
//

import AVFoundation
import UIKit

class NaAudio: NSObject
{
    
    static func ready()
    {
        var audioPlayer: AVAudioPlayer?
        
        let pathURL = NSURL(fileURLWithPath: Bundle.main.path(forResource: "201014163042528", ofType: "wav")!)
        
        do
        {
            audioPlayer = try AVAudioPlayer(contentsOf: pathURL as URL)
        }
        catch
        {
            print("error")
            audioPlayer = nil
        }
        
        audioPlayer?.prepareToPlay()
        
        audioPlayer?.play()
    }

    public static func sheep()
    {
        //let url = NSURL(fileURLWithPath:Bundle.main.path(forResource: "201014163042528", ofType:"wav")!)

        let avPlayer = AVPlayer(url: NSURL(fileURLWithPath: Bundle.main.path(forResource: "201014163042528", ofType: "wav")!) as URL)
        avPlayer.play()
    }

}
